package com.yao.presenter

import com.base.mvp.IModel
import com.base.mvp.IView
import com.yao.AppConfig
import com.yao.http.Result
import com.yao.presenter.bean.IndexDataBean
import io.reactivex.Flowable
import okhttp3.RequestBody
import retrofit2.http.Body
import retrofit2.http.Headers
import retrofit2.http.POST

interface SearchContract {
    interface Model : IModel<Api> {
        fun getSearchData(str: String): Flowable<Result<List<IndexDataBean.ChildrenBean>>>
    }

    interface View : IView {
        fun onSuccessData(data: List<IndexDataBean.ChildrenBean>)

        fun onFail(code: Int, msg: String)
    }

    interface Presenter {
        fun getSearchData(str: String)
    }

    interface Api {
        @Headers("Tag:" + AppConfig.Http.API_SEARCH)
        @POST(AppConfig.Http.API_SEARCH)
        fun getSearchData(@Body body: RequestBody): Flowable<Result<List<IndexDataBean.ChildrenBean>>>
    }
}